/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hojadetrabajo7;

/**
 *
 * @author RAUL
 */

    import java.awt.Font;



/**
 * An immutable binary tree that can draw itself.
 *
 * @author Rod Howell
 *        
 */
public final class BinaryTree implements Cloneable {

  private boolean empty;

  private Arbol arbol; 
  
  private Node root;

  
  private BinaryTree left;

 
  private BinaryTree right;

  private BinaryTree tree; 
  

 
  /**
   * este es el constructor 
   */
  public BinaryTree() {
    empty = true;
    
  }

  
  /**
   * 
   * @param root esta es la raiz del arbol
   * @param left este da el hijo izquierdo
   * @param right este da el hijo derecho 
   * @throws NullPointerException
   */
  public BinaryTree(Node root, BinaryTree left, BinaryTree right) 
    throws NullPointerException {
    empty = false;
    this.root = root;
    this.left = left == null ? new BinaryTree() : left;
    this.right = right == null ? new BinaryTree() : right;
    				 
  }

  /**
   * Returns <tt>true</tt> if this tree is empty.
   * @return 
   */
  public boolean isEmpty() {
    return empty;
  }

  /**
   * Returns the root of this tree.
   * @return 
   */
  public  Node getRoot() {
    if (empty) {
      root = null;
      return root; 
    }
    else {
      return root;
     
    }
  }

  /**
   * Returns the left-hand child of this tree.
   * @return 
   */
  public BinaryTree getLeftChild() {
    if (empty) {
     left= null;
      return left; 
    }
    else {
      return left;
    }
  }

  

  
 
  public Object clone() {
    return this;
  }
}

